<template>
  <div>
    <!--操作 -->
    <button-area :style="{ paddingLeft: '80px' }"></button-area>
    <div>
      <FormPanel ref="formPanel" columnsRef="lhmMaintionClaimReceiptIncom" :list="formList" :cols="3" :labelWidth="130" :isSubmitBtn="false" @formChange="formChangeHandle" />
    </div>
    <div
      :style="{
        position: 'absolute',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'right'
      }"
    >
      <el-button @click="closeDialog">关 闭</el-button>
      <AjaxButton :click="saveDialog" type="primary">保存</AjaxButton>
    </div>
  </div>
</template>

<script>
import { dictionary } from '@/utils/dictMixin';
// import { addMaintionClaimReceiptData } from '@/api/claimManagement/query/maintionClaimReceipt';
import moment from 'moment';
export default {
  name: 'lhmMaintionClaimReceiptIncom',
  components: {},
  mixins: [dictionary],
  data() {
    this.saveData = {};
    this.helpData = null;
    return {
      visible: false,
      formList: this.createFormList()
    };
  },
  computed: {},
  created() {
    // this.formList.find(x => x.fieldName === 'yearmonth').initialValue=new Date();
    // this.formList.find(x => x.fieldName === 'receiptAt').initialValue= new Date();
  },
  methods: {
    createFormList() {
      return [
        // {
        //   type: 'DATE',
        //   label: '年月',
        //   fieldName: 'yearmonth',
        //   disabled:true,
        //   initialValue: moment().format('YYYY-MM-DD'),
        //   dateFormat: 'yyyy-MM-dd'
        // },
        {
          type: 'DATE',
          label: '年月',
          fieldName: 'yearmonth',
          disable: true,
          initialValue: moment().format('YYYY-MM-DD HH:mm:ss')
        },
        {
          type: 'INPUT_NUMBER',
          label: '金额',
          fieldName: 'money',
          precision: 2,
          placeholder: '请输入...',
          initialValue: 0
        },
        {
          type: 'DATE',
          label: '发票日期',
          fieldName: 'receiptAt',
          initialValue: moment().format('YYYY-MM-DD HH:mm:ss')
        },
        {
          type: 'INPUT',
          label: '发票号',
          fieldName: 'receiptOrder'
        }
      ];
    },
    formChangeHandle(val) {
      this.saveData = val;
    },
    async saveDialog() {
      let res = {};
      const [err, data] = await this.$refs.formPanel.GET_FORM_DATA(); // 获取from改变时整个表单的值
      console.log('data', data);
      if (err) return;
      // res = await addMaintionClaimReceiptData({ ...data });
      // if (res.resultCode === 200) {
      //   // / this.isdisabled = false; //处理库存的按钮是否显示
      //   this.closeDialog('refresh');
      //   return this.$notify({
      //     title: '提示信息',
      //     message: '保存成功',
      //     type: 'success'
      //   });
      // }
    },

    closeDialog(param) {
      this.$emit('close', false, param);
    }
  }
};
</script>

<style lang="less" scoped></style>
